<div class="box">
    <div class="heading">
        <h1><img alt="" src="<?php echo base_url('assets/admin/images/review.png'); ?>"> All Users</h1>
		<div class="buttons">
            <ul id="add_entry_btn">
				<li>
					<a class="button" href="<?php echo base_url(ADMIN_PATH . "/users/addusers"); ?>"><span>Add User</span></a>
				</li>
                <li>
                    <a class="button delete" href="#"><span>Delete</span></a>
                </li>
            </ul>
        </div>  
    </div>
    <div class="content">
		
		<?php echo form_open(null, 'id="form"'); ?>
        <table id="entries_table" class="list">
            <thead>
                <tr>
                    <th width="1" class="center"><input type="checkbox" onClick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></th>
					<th class="right"><a rel="id" class="sortable" href="#">#ID</a></th>
					<th class="left"><a rel="id" class="sortable" href="#">Group Type</a></th>
                    <th><a rel="title" class="sortable" href="#">Firast Name</a></th>
                    <th><a rel="slug" class="sortable" href="#">Last Name</a></th>
					 <th><a rel="status" class="sortable" href="#">Address</a></th>
					<th><a rel="uri" class="sortable" href="#">Email</a></th>
                    <th><a rel="status" class="sortable" href="#">Phone No</a></th>
					<th><a rel="date_added" class="sortable" href="#">Date Added</a></th>
                    <th class="right">Action</th>
                </tr>
            </thead>
            <tbody>
			
                <?php if ($users){?>
                    <?php foreach($users as $user){ ?>
                    <tr>
                        <td class="center"><input type="checkbox" value="<?php echo $user['userid'] ?>" name="selected[]" /></td>
						<td><?php echo $user['userid']; ?></td>
						<td><?php echo $user['group_type']; ?></td>
                        
                        <td><?php echo $user['firstname']; ?></td>
                        <td><?php echo $user['lastname']; ?></td>
                        <td class="right"><?php echo $user['address']; ?></td>
                        
                        <td><?php echo $user['email']; ?></td>
						<td><?php echo $user['phoneno']; ?></td>
						<td><?php echo date('m/d/Y h:i a', strtotime($user['date_added'])); ?></td>
                        
                        <td class="right">[ <?php echo anchor(ADMIN_PATH . "/users/edituser/" . $user['userid'], 'Edit'); ?> ]</td>
                    </tr>
                    <?php } ?>
                <?php }else { ?>
                    <tr class="center"><td colspan="8">No results found.</td></tr>
                <?php } ?>
            </tbody>
        </table>
        <?php echo form_close(); ?>
        
    </div>
</div>
<script>
 // Delete
        $('.delete').click( function() {
            if (confirm('Delete cannot be undone! if users delete then corresponding business delete. Are you sure you want to do this?'))
            {
                $('#form').attr('action', '<?php echo site_url(ADMIN_PATH . '/users/deleteuser'); ?>').submit()
            }
            else
            {
                return false;
            }
        });
</script>

